<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                xmlns:security="http://www.springframework.org/security/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">外推用户权限管理后台</ui:define>
    <ui:define name="content">
        <h:form>
            <p:defaultCommand target="search"/>
            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="left">
                        <p:commandButton id="toggler" type="button" value="展示选择"
                                         style="width: auto;"
                                         icon="ui-icon-calculator"
                                         rendered="#{security:areAllGranted('GALAXY_CARD_PROMOTE_CHANNEL_USER_RIGHT_SEARCH')}"/>
                        <p:columnToggler datasource="galaxyCardOrderStatDataTable" trigger="toggler"
                                         rendered="#{security:areAllGranted('GALAXY_CARD_PROMOTE_CHANNEL_USER_RIGHT_SEARCH')}"/>
                    </f:facet>
                    <f:facet name="right">
                        <p:commandButton id="search" value="查询" icon="fa fa-search"
                                         update="@form"
                                         rendered="#{galaxyCardPromoteChannelUserBean.isNormal() and security:areAllGranted('GALAXY_CARD_PROMOTE_CHANNEL_USER_RIGHT_SEARCH')}"/>
                         <p:commandButton value="导出" icon="fa fa-download"
                                         rendered="#{galaxyCardPromoteChannelUserBean.isNormal() and security:areAllGranted('GALAXY_CARD_PROMOTE_CHANNEL_USER_RIGHT_ADD')}"
                                         ajax="false">
                            <p:dataExporter type="xls" target="galaxyCardOrderStatDataTable" fileName="export"/>
                        </p:commandButton>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-fluid" style="padding-top: 30px;">
                <div class="ui-g">
                    <div class="ui-g-12">
                        <div class="card">
                            <h1>查询条件</h1>
                            <p:panelGrid columns="8" layout="grid"
                                         columnClasses="ui-grid-col-1,ui-grid-col-2"
                                         styleClass="ui-panelgrid-blank"
                                         style="border:0px none; background-color:transparent;">
                                         
                                <p:outputLabel for="userId" value="姓名"/>
                   				<p:inputText id="userId" value="#{galaxyCardPromoteChannelUserBean.$.userName}" style="width:100%"/>
                   				
                            </p:panelGrid>
                        </div>
                        <div class="card">
                            <p:dataTable id="galaxyCardOrderStatDataTable"
                                         style="width: 100%"
                                         var="record"
                                         value="#{galaxyCardPromoteChannelUserBean.lazyDataModel}"
                                         rows="#{constants:get('ROWS')}"
                                         lazy="true"
                                         paginator="true"
                                         paginatorTemplate="#{constants:get('PAGINATOR_TEMPLATE')}"
                                         rowsPerPageTemplate="#{constants:get('ROWS_PER_PAGE_TEMPLATE')}"
                                         emptyMessage="#{constants:get('EMPTY_MESSAGE')}"
                                         scrollable="true"
                                         scrollWidth="97%"
                                         reflow="true"
                                         selection="#{galaxyCardPromoteChannelUserBean.selectedRecords}"
                                         resizableColumns="true"
                                         rendered="#{security:areAllGranted('GALAXY_CARD_PROMOTE_CHANNEL_USER_RIGHT_SEARCH')}">
                                                    
                                
                                  <p:column headerText="操作" rendered="#{galaxyCardPromoteChannelUserBean.isNotBatch()}">
                                    <p:splitButton icon="fa fa-eye" action="#{galaxyCardPromoteChannelUserBean.onEdit(record.userId)}"
                                                   process="@this">
                                        <f:setPropertyActionListener value="/views/galaxycard/galaxy-card-promote-channel-user-right-list.xhtml"
                                                                     target="#{currentUserBean.back}"/>
                                        <p:menuitem value="关联渠道" icon="fa fa-users"
                                                    action="#{galaxyCardPromoteChannelUserBean.onRelateChannel(record.userId)}"
                                                    process="@this"
                                                    rendered="#{security:areAllGranted('GALAXY_CARD_PROMOTE_USER_RELATE_CHANNEL')}">
                                            <f:setPropertyActionListener value="/views/galaxycard/galaxy-card-promote-channel-user-right-list.xhtml"
                                                                         target="#{currentUserBean.back}"/>
                                        </p:menuitem>
                                    </p:splitButton>
                                </p:column>
                                
                                <p:column headerText="用户名">
                                    <h:outputText value="#{record.userName}"/>
                                </p:column>
                                <p:column headerText="角色名">
                                    <h:outputText value="#{record.roleName}"/>
                                </p:column>
                            </p:dataTable>
                        </div>
                    </div>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>
